On Blockchain
__TOC__ General * Blockchain ** a distributed database that maintains a continuously-growing list of records called blocks. * A Next-Generation Smart Contract and Decentralized Application Platform * On Public and Private Blockchains (August 7th, 2015) * What are the best open source projects to study blockchain technology in terms of simplicity? * What is the best programming language to learn if you want to work on the blockchain? * Bitcoin mining the hard way: the algorithms, protocols, and bytes * A 101 Noob Intro to Programming Smart Contracts on Ethereum * [https://www.linkedin.com/pulse/blockchain-database-adi-ben-ari Blockchain as a Database] (July 31, 2015) Smart Contract * Smart Contract (on Wikipedia) Hyperledger * Hyperledger Projects ** Hyperledger Cello ** Hyperledger Fabric ** Hyperledger Iroha ** Hyperledger Sawtooth Lake Hyperledger Fabric * https://github.com/hyperledger/fabric * Desc. : an implementation of blockchain technology, leveraging familiar and proven technologies. * License : Apache License Version 2.0 * Written in : Go * Docker repository : https://hub.docker.com/u/hyperledger/ * Docker images : https://github.com/hyperledger/fabric/tree/master/images * References ** Official documentation ** Transaction Flow ** CLI ** Specification *** REST API * Readings ** Setup *** Getting Setup *** Setting Up a Network *** Multichannel Setup *** Install and Instantiate *** v1.0.0-alpha2 **** sample configtx.yaml **** sample core.yaml **** sample orderer.yaml **** Getting Started *** v1.0.0-beta **** sample crypto-config.yaml ** Ordering *** A Kafka-based Ordering Service for Fabric ** Chaincode *** What is chaincode? *** Java chaincode *** [http://hyperledger-fabric.readthedocs.io/en/latest/Setup/Chaincode-setup.html Writing, Building, and Running Chaincode in a Development Environment] *** Chaincode examples ** SDK *** Hyperledger Fabric SDK Design Specification v1.0 ** misc *** Hyperledger Fabric Approaches v1.0 with Better Scalability and Security *** Logging Control * Examples ** CLI based End-to-End Flow *** 1 Orderer, 3 Peer, 1 CLI *** configtx.yaml *** docker-compose.yaml *** docker-compose-no-tls.yaml *** script.sh : called by yaml file * Demos ** ITPeople Blockchain - Art Auction Demo ** IBM Blockchain - Marbles Demo * Sources ** fabric/core/ledger/util/couchdb/couchdb.go *** 1.0.0-alpha **** handleRequest(method, connectURL string, data io.Reader, rev string, multipartBoundary string) (*http.Response, *DBReturn, error) *** 1.0.0-beta **** handleRequest(method, connectURL string, data [byte, rev string, multipartBoundary string, maxRetries int, keepConnectionOpen bool) (*http.Response, *DBReturn, error)] ** fabric/core/chaincode/shim/interfaces.go *** 1.0.0-alpha **** PutState(key string, value [byte) error] **** GetState(key string) ([byte, error)] Docker Images fabric-peer Config which is printed by "docker inspect --format=' ' ..." is "Config": { "Hostname": "e7eddde82bec", "Domainname": "", "User": "", "AttachStdin": false, "AttachStdout": false, "AttachStderr": false, "Tty": false, "OpenStdin": false, "StdinOnce": false, "Env": [ "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin", "PEER_CFG_PATH=/etc/hyperledger/fabric", "CORE_PEER_MSPCONFIGPATH=/etc/hyperledger/fabric/msp/sampleconfig" ], "Cmd": [ "peer", "node", "start" ], "ArgsEscaped": true, "Image": "sha256:793719e9dd193f580f32c5984ac47a8c0f986819e4795c039703b26bb6ad15ce", "Volumes": null, "WorkingDir": "", "Entrypoint": null, "OnBuild": [], "Labels": { "org.hyperledger.fabric.base.version": "0.3.0", "org.hyperledger.fabric.version": "1.0.0-alpha" } }, Fabric SDK for Node.js * Sources : ** https://github.com/hyperledger/fabric-sdk-node ** https://github.com/hyperledger/fabric-sdk-node/tree/master/fabric-client ** https://github.com/hyperledger/fabric-sdk-node/tree/master/fabric-ca-client * Features ** create channels ** ask peer nodes to join the channel ** install chaincodes in peers ** instantiate chaincodes in a channel ** invoke transactions by calling the chaincode ** query the ledger for transactions or blocks * Readings ** Official documentation ** [https://fabric-sdk-node.github.io/ Application developer documentations] * Examples ** Balance transfer example *** https://github.com/hyperledger/fabric-sdk-node/tree/master/examples/balance-transfer Network Setup Setup and launch Fabric CA server # Install Go 1.7+ # Set GOPATH # Install libtool and libtdhl-dev #* # sudo apt install libtool libltdl-dev # Install fabric-ca-server and fabric-ca-client Performance Tuning * JBOD or RAID * LVM (Logical Volume Manager) * Filesystem Journaling ** Disabling Journaling in Ubuntu 14.04? * noatime ** Reducing Disk IO By Mounting Partitions With noatime ** Is it worth to tune Ext4 with noatime? (Aug 12 '10) ** RHEL 6 Filesystem Mount Options * Disk I/O Scheduler ** Selecting a Linux I/O Scheduler ** Linux Change The I/O Scheduler For A Hard Disk * Docker OverlayFS storage driver ** Use the OverlayFS storage driver Eris * https://monax.io/ * Desc. : an open platform for developers and devops to build, ship, and run blockchain-based applications for business ecosystems. * License : https://monax.io/library/#licensing * Sources : https://github.com/eris-ltd * References ** Eris official documentation ** Eris Getting Started *** Building Your First Blockchain App with Eris (August 24, 2016) ** Eris Command Line Interface ** [https://monax.io/docs/documentation/db/latest/specifications/api/ Eris DB Web APIs] ** Jobs Specification ** Variables Specification * Readings ** Using Docker Machine With Eris ** On Eris and Tendermint: Application and Consensus (2016/03/02) ** Cannot deploy smart contract with Eris / Monax *** Could not perform pkg action service: Could not perform pkg action: Docker: {"mssage":"Cannot link to a non running container: /simplechain ** The Blockchain Explained to Web Developers, Part 1: The Theory (2016/04/28) ** The Blockchain Explained to Web Developers, Part 2: In Practice (2016/05/20) ** The Blockchain Explained to Web Developers, Part 3: The Truth (2016/06/14) ** Eris and Ethereum - Decentralized computing on a blockchain (May 20, 2015) Solidity * Solidity (on Wikipedia) ** an object-oriented programming language for writing smart contracts. * Solidity official documentation ** Solidity in Depth *** Units and Globally Available Variables * Solidity sources (on GitHub) * Solidity browser based compiler * Javascript bindings for the solidity compiler ** compile function * Solidity Tutorials * Ethereum Contract ABI Tendermint * https://tendermint.com/ * Desc. : Byzantine fault-tolerant replicated state machines in any programming language * License : ?